package com.yitiao.designmodel.struct.facade;

public class FacadeService {

    private PayService payService=new PayService();
    private LogisticsService logisticsService=new LogisticsService();
    private StockService stockService=new StockService();

    public void order(Goods goods){
        // 校验库存
        if (stockService.check(goods.getName())){
            System.out.println("库存充足，请支付");
            // 支付
            payService.pay(goods.getPrice());
            // 发货
            logisticsService.push();
        }else{
            System.out.println("库存不足");
        }

    }
}
